package ru.tulupov.producerconsumerpattern;

import java.util.Random;

public class TVProducer extends AbstractProducer {
	private final Random random = new Random();

	public TVProducer(Storage<Playable> storage) {
		super(storage);
	}

	private Channel randomChannel() {
		final Channel[] channels = { Channel.CHANNEL_1, Channel.CHANNEL_2 };

		return channels[random.nextInt(channels.length)];
	}

	private long randomTimestamp() {
		return random.nextInt(5);
	}

	@Override
	protected Playable onCreate() {
		return new TV(randomChannel(), randomTimestamp());
	}

}
